<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let p = new Promise((resolve, reject)=>{
            resolve('ok'); // p 成功 结果是 ok
            setTimeout(()=>{
                reject('error');
            },1000);
        })

        let res = p.then(value=>{
            setTimeout(()=>{
                return value;
            },1000);
        },reason=>{
            setTimeout(()=>{
                return new Promise((resolve, reject)=>{
                    reject('reason');
                })
            },1000);
        })
        console.log('res: ', res);
    </script>
</body>
</html>